
import os
import sys
from itertools import accumulate

# 请在此输入您的代码

def dfs(depth, weight, cnt):
  global ans
  if cnt > ans:
      return
  if weight > m: #超过了重量， jian
    return
  if weight == m:
    ans = min(ans, cnt)
  if depth == n or weight + B[depth] < m:
    return

  #枚举3种情况
  dfs(depth+ 1, weight + 0, cnt)
  dfs(depth + 1, weight + A[depth], cnt)
  dfs(depth + 1, weight + A[depth] // 2, cnt + 1)


n, m = map(int, input().split())
m *= 2
A = list(map(int, input().split()))
A.sort()
A = [x << 1 for x in A]
B = list(accumulate(A))
A = A[::-1]
B = B[::-1]
ans  = n + 1
dfs(0, 0, 0)
if ans == n + 1:
    ans = -1
print(ans)